<?php

    namespace yaliSDK\user;

    use think\Exception;
    use yaliSDK\common\BaseRepository;
    use yaliSDK\common\IRepository;

    class UserRepository extends BaseRepository implements IRepository {
        private static $TABLE = 'member';
        function save($data, $option = []): bool {
        }

        function get($id, $option = []) {
            $user = null;
            try {
                $key = $option['key'] ?? 'id';
                $user = $this->db->name(self::$TABLE)->where([$key => $id])->find();
            } catch (Exception $e) {
            }
            return $user;
        }

        function lists($option = []) {
        }

        function update($data, $option = []): bool {
        }
        function isExist($id, $option): bool {
            $key = $option['key'] ?? 'id';
            return $this->db->name(self::$TABLE)->where([$key=>$id])->count('id') > 0;
        }
    }